﻿@model IEnumerable<PaginaWeb.Models.MiProducto>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_AdministradorLayout.cshtml";
}

<h2>Lista de Productos</h2>

<div ALIGN="center">
<button>
    @Html.ActionLink("Crear Nuevo Producto", "Create")
</button>
 <br />
</div>
<div align="center">
    <button>
        <a href="~/marca/create">Crear Marca</a>
    </button>
    <br />
</div>
<table class="table table-striped">
        <tr>
      
        <th>
            @Html.DisplayNameFor(model => model.nombre)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.modelo)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.marca)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.precio)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.descripcion)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.url)
        </th>
        </tr>
    
@foreach (var item in Model) 
{
    <tr>
        
        <td>
            <a href="~/Cliente/Detalle/@item.id" target="_blank">
                @Html.DisplayFor(modelItem => item.nombre)
            </a>
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.modelo)
        </td>
        <td>
            <a href="~/Marca/Details/@item.marca.id">
            @Html.DisplayFor(modelItem => item.marca.nombre)
            <img src="@Html.DisplayFor(modelItem => item.marca.foto)" height="100" width="100" />    
                 </a>
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.precio)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.descripcion)
        </td>
         <td>
            <img src="@Html.DisplayFor(modelItem => item.url)" class="img-rounded" style="max-width: 30%"/>
        </td>
        
        <td>
            @Html.ActionLink("Editar", "Edit", new { id=item.id }) |
            @Html.ActionLink("Detalles", "Details", new { id=item.id }) |
            @Html.ActionLink("Borrar", "Delete", new { id=item.id })
        </td>
      </tr>
}
   </table>

